package changceilingcolor003;
//import physicsterm202.SpringClass;
import toxi.geom.Vec3D;
import toxi.physics.VerletParticle;
import toxi.physics.VerletSpring;

public class Creator {
	ChangCeilingColor003 p5;
	Vec3D loc=new Vec3D();
	Vec3D loc2=new Vec3D();
	Vec3D cen;
	float radius;
	boolean u_active;
	//float angle=0;	  
	//float z=0;
	int count=32;
	//int count=6;
	float speed=p5.TWO_PI/count;
	int uColor_R;
	int uColor_G;
	int uColor_B;
	//SpringClass spring1;
	//SpringClass spring10;

	Creator(ChangCeilingColor003 _p5,Vec3D _cen,float _radius,boolean _u_active,int _uColor_R,int _uColor_G,int _uColor_B) {
		p5 = _p5;
		cen=_cen;
		radius=_radius;
		u_active= _u_active;
		uColor_R=_uColor_R;
		uColor_G=_uColor_G;
		uColor_B=_uColor_B;
		
	}

	void run() {
		display();

	}

	void display() {
		for(int i=1;i<=count;i++){
			loc= new Vec3D(cen.x+p5.cos(speed*i)*radius*5/6, cen.y+p5.sin(speed*i)*radius*5/6, cen.z);
			loc2= new Vec3D(cen.x+p5.cos(speed*(i-1))*radius*5/6, cen.y+p5.sin(speed*(i-1))*radius*5/6, cen.z);
			//VerletParticle vp=(VerletParticle)physics.particles.get((int)p5.random(0, p5.physics.particles.size())) ;
			VerletParticle p= new VerletParticle(loc.x, loc.y, loc.z);
			VerletParticle p1=new VerletParticle(cen.x, cen.y, cen.z);
			VerletParticle p2= new VerletParticle(loc2.x, loc2.y, loc2.z);
			if(i%9!=0&&i%7!=0&&i%8!=0&&i%10!=0)p5.physics.addParticle(p);
			//SpringClass  sp=new SpringClass(p, p2, 10, 0.1f);
			VerletSpring  sp=new VerletSpring(p, p2, 10, 0.1f);
			VerletSpring sp2=new VerletSpring(p1, p2, radius, 1.0f);

			if(i%9!=0&&i%7!=0&&i%8!=0&&i%10!=0)p5.physics.addSpring(sp);
			//p5.physics.addSpring(sp2);
			
			//spring1 = new SpringClass(p5,p, p2, 10, 0.1f,20);
			//spring10 = new SpringClass(p5,p1, p2, radius, 1.0f,100);
			//p5.physics.addSpringClass(spring1);
			//p5.physics.addSpringClass(spring10);
		}
	}
	

}
